const { ccclass, property } = cc._decorator;

@ccclass
export default class HoneyPrefab extends cc.Component {
@property([cc.Node])
fillSide = [];

@property(cc.Node)
noSide = null;

@property([cc.Node])
corners = [];

@property([cc.Node])
outSides0 = [];

@property([cc.Node])
outSides1 = [];

@property([cc.Node])
outSides2 = [];

gridShowArr = [];
direArr = [];
angleArr = [];

onLoad() {}

hideAllNode() {
    this.node.children.forEach(function (node) {
        node.active = false;
    });
}

init(e, t) {
    this.hideAllNode();
    this.direArr = e;
    this.angleArr = t;
    let a = true,
        o = true,
        i = true,
        r = true;

    for (let n = 0; n <= 3; n++) {
        if (e[n] !== 1) {
            a = false;
        } else {
            o = false;
        }

        if (t[n] !== 1) {
            i = false;
        } else {
            r = false;
        }
    }
this.noSide.active = true;
    if (a && i) {
        // this.fillSide.forEach(function (node) {
        //     node.active = true;
        // });
    } else if (o && r) {
        // this.noSide.active = true;
    } else {
        for (let l = 0; l <= 3; l++) {
            this.setCorners(l);
        }
    }
}

setCorners(e) {
    return;
    let t = this.direArr[e];
    let a = this.angleArr[e];
    let o = this.direArr[e + 1];

    if (e === 3) {
        o = this.direArr[0];
    }

    if (a && t && o) {
        // this.node.getChildByName("fill_" + e).active = true;
    }

    if (a && !t && !o) {
        this.node.getChildByName("outside_" + e + "_2").active = true;
        this.node.getChildByName("jiao_" + e).active = true;
    }

    if (a && t && !o) {
        this.node.getChildByName("outside_" + e + "_1").active = true;

        if (e === 3) {
            this.node.getChildByName("side_0_0").active = true;
        } else {
            this.node.getChildByName("side_" + (e + 1) + "_0").active = true;
        }
    }

    if (a && !t && o) {
        this.node.getChildByName("outside_" + e + "_0").active = true;
        this.node.getChildByName("side_" + e + "_1").active = true;
    }

    if (!a && t && o) {
        this.node.getChildByName("jiao_" + e).active = true;
    }

    if (!a && t && o) {
        this.node.getChildByName("neiao_" + e).active = true;
    }

    if (!a && t && o) {
        if (e === 3) {
            this.node.getChildByName("side_0_0").active = true;
        } else {
            this.node.getChildByName("side_" + (e + 1) + "_0").active = true;
        }
    }
}

setAllSideActive(e) {
    return;
    for (let t = 0; t <= 3; t++) {
        this.node.getChildByName("side_" + t + "_1").active = e;
        this.node.getChildByName("side_" + t + "_0").active = e;
    }
}

setSidesActive(e) {
    return;
    if (this.node.getChildByName("outside_" + e + "_0").active) {
        this.node.getChildByName("side_" + e + "_1").active = true;
    }

    if (this.node.getChildByName("outside_" + e + "_1").active) {
        this.node.getChildByName("side_" + e + "_0").active = true;
    }

    if (this.node.getChildByName("outside_" + e + "_2").active) {
        this.node.getChildByName("side_" + e + "_1").active = true;

        if (e === 3) {
            this.node.getChildByName("side_0_0").active = true;
        } else {
            this.node.getChildByName("side_" + (e + 1) + "_0").active = true;
        }
    }

    if (this.node.getChildByName("jiao_" + e).active) {
        this.node.getChildByName("fill_" + e).active = false;
        this.node.getChildByName("side_" + e + "_0").active = true;
        this.node.getChildByName("side_" + e + "_1").active = false;

        if (e === 3) {
            this.node.getChildByName("side_0_0").active = false;
            this.node.getChildByName("side_0_1").active = true;
        } else {
            this.node.getChildByName("side_" + (e + 1) + "_0").active = false;
            this.node.getChildByName("side_" + (e + 1) + "_1").active = true;
        }
    }

    if (this.node.getChildByName("neiao_" + e).active) {
        this.node.getChildByName("side_" + e + "_0").active = false;
        this.node.getChildByName("side_" + e + "_1").active = false;

        if (e === 3) {
            this.node.getChildByName("side_0_0").active = false;
            this.node.getChildByName("side_0_1").active = false;
        } else {
            this.node.getChildByName("side_" + (e + 1) + "_0").active = false;
            this.node.getChildByName("side_" + (e + 1) + "_1").active = false;
        }
    }
}

start() {}
}